# coding: utf-8

import yaml
import pytest
from common import get_project_path

# 封装yml文件读取方法
def get_yml_data(filename):
    project_path = get_project_path.get_project_path()  # 调用函数，获取当前项目根目录
    file_path = project_path + '\\data\\page_element\\' + filename # 读取的yml文件# 文件路径
    with open(file_path, encoding='utf-8') as f:
        # print("\n*****转换yaml数据为字典或列表*****")
        # 设置Loader=yaml.FullLoader忽略YAMLLoadWarning警告
        data = yaml.load(f, Loader=yaml.FullLoader)
    print(data)
    return data


filename = 'login.yml'


if __name__ == '__main__':
    get_yml_data(filename)
    # pytest.main(['-vs', 'read_yml.py'])
